home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / os2 / gnuwget.zip / wget-1.4.3 / doc / wget.info-1 (.txt) < prev    next >
GNU Info File  |  1997-02-09  |  46KB  |  853 lines

  1. This is Info file wget.info, produced by Makeinfo version 1.67 from the
  2. input file ./wget.texi.
  3.    Permission is granted to make and distribute verbatim copies of this
  4. manual provided the copyright notice and this permission notice are
  5. preserved on all copies.  Permission is granted to copy and distribute
  6. modified versions of this manual under the conditions for verbatim
  7. copying, provided also that the sections entitled "Copying" and "GNU
  8. General Public License" are included exactly as in the original, and
  9. provided that the entire resulting derived work is distributed under
  10. the terms of a permission notice identical to this one.
  11. File: wget.info,  Node: Top,  Next: Overview,  Prev: (dir),  Up: (dir)
  12. Wget/1.4.3
  13. **********
  14.    This manual documents version 1.4.3 of GNU Wget, the freely available
  15. utility for network download.
  16.    Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  17. * Menu:
  18. * Overview::            Features of Wget.
  19. * Invoking::            Wget command-line arguments.
  20. * Recursive Retrieval:: Description of recursive retrieval.
  21. * Following Links::     The available methods of chasing links.
  22. * Time-Stamping::       Mirroring according to time-stamps.
  23. * Startup File::        Wget's initialization file.
  24. * Examples::            Examples of usage.
  25. * Various::             The stuff that doesn't fit anywhere else.
  26. * Appendices::          Some useful references.
  27. * Copying::             You may give out copies of Wget.
  28. * Concept Index::       Topics found in this manual.
  29. File: wget.info,  Node: Overview,  Next: Invoking,  Prev: Top,  Up: Top
  30. Overview
  31. ********
  32.    GNU Wget is a freely available network utility to retrieve files from
  33. the World Wide Web, using HTTP (Hyper Text Transfer Protocol) and FTP
  34. (File Transfer Protocol), the two most widely used Internet protocols.
  35. It has many useful features to make downloading easier, some of them
  36. being:
  37.    * Wget is non-interactive, which means it can work in the background,
  38.      while the user is not logged on, so that you may start the program
  39.      and log off, letting it do its work.  By contrast, most of the Web
  40.      browsers require constant user's presence, which can be a great
  41.      hindrance when transferring a lot of data.
  42.    * Wget is capable of descending recursively through the structure of
  43.      HTML documents and FTP directory trees, making a local copy of the
  44.      directory hierarchy similar to the one on the remote server.  This
  45.      feature can be used to mirror archives and home pages, or traverse
  46.      the web in search of data, like a WWW robot (*Note Robots::).  In
  47.      that spirit, Wget understands the `norobots' convention.
  48.    * File name wildcard matching and recursive mirroring of directories
  49.      are available when retrieving via FTP.  Wget can read the
  50.      time-stamp information given by both HTTP and FTP servers, and
  51.      store it locally.  Thus Wget can see if the remote file has
  52.      changed since last retrieval, and automatically retrieve the new
  53.      version if it has.  This makes Wget suitable for mirroring of FTP
  54.      sites, as well as home pages.
  55.    * Wget works exceedingly well on slow or unstable connections,
  56.      keeping getting the document until it is fully retrieved, or until
  57.      a user-specified retry count is surpassed.  It will try to resume
  58.      the download from the point of interruption, using `REST' with FTP
  59.      and `Range' with HTTP servers that support them.
  60.    * By default, Wget supports PROXY servers, which can lighten the
  61.      network load, speed up retrieval and provide access behind
  62.      firewalls.  However, if you are behind a firewall that requires
  63.      that you use a socks style gateway, you can get the socks library
  64.      and build wget with support for socks.  Wget also supports the
  65.      passive FTP downloading as an option.
  66.    * Builtin features offer mechanisms to tune which links you wish to
  67.      follow (*Note Following Links::).
  68.    * The retrieval is conveniently traced with printing dots, each dot
  69.      representing a fixed amount of data received (1KB by default).
  70.      These representations can be customized to your preferences.
  71.    * Most of the features are fully configurable, either through
  72.      command line options, or via the initialization file `.wgetrc'
  73.      (*Note Startup File::).  Wget allows you to define "global"
  74.      startup files (`/usr/local/etc/wgetrc' by default) for site
  75.      settings.
  76.    * Finally, GNU Wget is free software.  This means that everyone may
  77.      use it, redistribute it and/or modify it under the terms of the
  78.      GNU General Public License, as published by the Free Software
  79.      Foundation (*Note Copying::).
  80. File: wget.info,  Node: Invoking,  Next: Recursive Retrieval,  Prev: Overview,  Up: Top
  81. Invoking
  82. ********
  83.    By default, Wget is very simple to invoke.  The basic syntax is:
  84.      wget [options] URL1 [URL2 ...]
  85.    Wget will simply download all the URLs specified on the command
  86. line.  URL is a "Uniform Resource Locator", as defined below.
  87.    Be aware that `ksh' and its descendants (like `zsh') kill off the
  88. background processes during logout.  To prevent this, use `nohup', as
  89. documented in system manuals.
  90.    However, you may wish to change some of the default parameters of
  91. Wget.  You can do it two ways: permanently, adding the appropriate
  92. command to `.wgetrc' (*Note Startup File::), or specifying it on the
  93. command line.
  94. * Menu:
  95. * URL Format::          What is considered a URL.
  96. * Option Syntax::       Syntax of options.
  97. * Basic Options::       Basic command line arguments.
  98. * Advanced Options::    Advanced command line arguments.
  99. File: wget.info,  Node: URL Format,  Next: Option Syntax,  Prev: Invoking,  Up: Invoking
  100. URL Format
  101. ==========
  102.    "URL" is an acronym for Uniform Resource Locator.  Wget recognizes
  103. the URL syntax as per RFC1738.  This is the most widely used form
  104. (square brackets denote optional parts):
  105.      http://host[:port]/path
  106.      ftp://host[:port]/path
  107.    You can also encode your username and password within a URL:
  108.      ftp://user:password@host/path
  109.      http://user:password@host/path
  110.    Either USER or PASSWORD, or both may be left out.  If you leave out
  111. either the HTTP username or password, no authentication will be sent.
  112. If you leave out the FTP username, `anonymous' will be used.  If you
  113. leave out the FTP password, your email address will be supplied as a
  114. default password.(1)
  115.    You can encode unsafe characters in a URL as `%xy', `xy' being the
  116. hexadecimal representation of the character's ASCII value.  Some common
  117. unsafe characters include `%' (quoted as `%25'), `:' (quoted as `%3A'),
  118. and `@' (quoted as `%40').  Refer to RFC1738 for a comprehensive list
  119. of unsafe characters.
  120.    Two alternative variants of URL specification are also supported,
  121. because of historical (hysterical?) reasons and their wide-spreadedness.
  122.    FTP-only syntax (supported by `NcFTP'):
  123.      host:/dir/file
  124.    HTTP-only syntax (introduced by `Netscape'):
  125.      host[:port]/dir/file
  126.    These two alternative forms are deprecated, and may cease being
  127. supported in the future.
  128.    If you do not understand the difference between these notations, or
  129. do not know which one to use, just use the plain ordinary format you use
  130. with your favorite browser, like `Lynx' or `Netscape'.
  131.    ---------- Footnotes ----------
  132.    (1)  If you have a `.netrc' file in your home directory, password
  133. will also be searched for there.
  134. File: wget.info,  Node: Option Syntax,  Next: Basic Options,  Prev: URL Format,  Up: Invoking
  135. Option Syntax
  136. =============
  137.    Since Wget uses GNU getopts to process its arguments, every option
  138. has a short form and a long form.  Long options are more convenient to
  139. remember, but take time to type.  You may freely mix different option
  140. styles, or specify options after the command-line arguments. Thus you
  141. may write:
  142.      wget -r --tries=10 http://fly.cc.fer.hr/ -o log
  143.    The space between the option accepting an argument and the argument
  144. may be omitted.  Instead `-o log' you can write `-olog'.
  145.    You may put several options that do not require arguments together,
  146. like:
  147.      wget -drc URL
  148.    This is a complete equivalent of:
  149.      wget -d -r -c URL
  150.    Since the options can be specified after the arguments, you may
  151. terminate them with `--'.  So the following will try to download URL
  152. `-x', reporting failure to `log':
  153.      wget -o log -- -x
  154.    The options that accept comma-separated lists all use the convention
  155. that, when presented an empty list, it means to clear it.  This can be
  156. useful to clear the `.wgetrc' settings.  So, if your .wgetrc sets the
  157. exclude_directories to `/cgi-bin', the following example will first
  158. reset it, and then set it to exclude `/~nobody' and `/~somebody'.  You
  159. can also clear the lists in `.wgetrc' (*Note Wgetrc Syntax::).
  160.      wget -X '' -X /~nobody,/~somebody
  161. File: wget.info,  Node: Basic Options,  Next: Advanced Options,  Prev: Option Syntax,  Up: Invoking
  162. Basic Options
  163. =============
  164.    The command line arguments, sorted alphabetically.
  165. `-a LOGFILE'
  166. `--append-output=LOGFILE'
  167.      Append to LOGFILE--the same as `-o', but appending to the LOGFILE
  168.      (or creating a new one if the old does not exist) instead of
  169.      overwriting the old log file.
  170. `--debug'
  171.      Turn on debug output, meaning various information important to the
  172.      developers of Wget if it does not work properly.  Your system
  173.      administrator may have chosen to compile Wget without debug
  174.      support.  In that case `-d' will not work.  Please note that even
  175.      if the program is compiled with debug support, it will *not* print
  176.      any debug info unless `-d' is turned on explicitly.  *Note
  177.      Reporting Bugs:: for more information on how to send a bug report.
  178. `--help'
  179.      Print a help screen. You will also get help if you do not supply
  180.      command-line arguments.
  181. `-i FILE'
  182. `--input-file=FILE'
  183.      Read URLs from FILE, in which case no URLs need to be on the
  184.      command line.  If there are URLs both on the command line and in
  185.      an input file, those on the command lines will be the first ones to
  186.      be retrieved.  The FILE need not be an HTML document (but no harm
  187.      if it is)--it is enough if the URLs are just listed sequentially.
  188.      However, if you specify `--force-html', the document will be
  189.      regarded as `html'.  In that case you may have problems with
  190.      relative links, which you can solve either by adding `<base
  191.      href="URL">' to the documents or by specifying `--base=URL' on the
  192.      command line.
  193. `-l DEPTH'
  194. `--level=DEPTH'
  195.      Specify recursion maximum depth level DEPTH (*Note Recursive
  196.      Retrieval::).  The default maximum depth is 5.
  197. `-nc'
  198. `--no-clobber'
  199.      Do not clobber existing files when saving to directory hierarchy
  200.      within recursive retrieval of several files. This option is
  201.      *extremely* useful when you wish to continue where you left off
  202.      with retrieval of many files.  If the files have the `.html' or
  203.      (yuck) `.htm' suffix, they will be loaded from the local disk, and
  204.      parsed as if they have been retrieved from the Web.
  205. `-o LOGFILE'
  206. `--output-file=LOGFILE'
  207.      Log all messages to LOGFILE, instead of standard output, which is
  208.      the default.  If you do not wish the log output to be verbose, use
  209.      `-nv' (non-verbose).
  210. `--quiet'
  211.      This option is the opposite of verbose, making Wget completely
  212.      quiet.
  213. `--recursive'
  214.      Turn on recursive retrieving (*Note Recursive Retrieval::).
  215. `-t NUM'
  216. `--tries=NUM'
  217.      Set number of retries to NUM.  Specify 0 or `inf' for infinite
  218.      retrying.
  219. `--version'
  220.      Display the version of Wget.
  221. `--verbose'
  222.      Turn on verbose output, with all the available data.  The default
  223.      output is verbose.
  224. File: wget.info,  Node: Advanced Options,  Prev: Basic Options,  Up: Invoking
  225. Advanced Options
  226. ================
  227.    The following table contains the alphabetically sorted list of the
  228. "advanced" command line arguments, for people familiar with basic
  229. operating of Wget, wishing to change its default behavior.  Not for the
  230. faint of heart.
  231. `-A ACCLIST --accept ACCLIST'
  232. `-R REJLIST --reject REJLIST'
  233.      Specify comma-separated lists of file name suffices or patterns to
  234.      accept or reject (*Note Types of Files:: for more details).
  235. `--continue'
  236.      Continue retrieval of FTP documents, from where it was left off by
  237.      another program or a previous instance of Wget.  Thus you can
  238.      write:
  239.           wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z
  240.      If there is a file name `ls-lR.Z' in the current directory, Wget
  241.      will assume that it is the first portion of the remote file, and
  242.      will require the server to continue the retrieval from an offset
  243.      equal to the length of the local file.
  244.      Note that you need not specify this option if all you want is Wget
  245.      to continue retrieving where it left off when the connection is
  246.      lost--Wget does this by default.  You need this option only when
  247.      you want to continue retrieval of a file already halfway
  248.      retrieved, saved by another FTP client, or left by Wget being
  249.      killed.
  250.      Without `-c', the previous example would just begin to download the
  251.      remote file to `ls-lR.Z.1'.  The `-c' option is also applicable
  252.      for HTTP servers that support the `Range' header.
  253. `-D DOMAIN-LIST'
  254. `--domains=DOMAIN-LIST'
  255.      Set domains to be accepted and DNS looked-up, where DOMAIN-LIST is
  256.      a comma-separated list.  Note that it does *not* turn on `-H'.
  257.      This option speeds things up, even if only one host is spanned
  258.      (*Note Domain Acceptance::).
  259. `--delete-after'
  260.      This option tells Wget to delete every single file it downloads,
  261.      *after* having done so.  It is useful for pre-fetching popular
  262.      pages through PROXY, e.g.:
  263.           wget -r -nd --delete-after http://whatever.com/~popular/page/
  264.      The `-r' option is to retrieve recursively, and `-nd' not to
  265.      create directories.
  266. `--dot-style=STYLE'
  267.      Set the retrieval style to STYLE.  Wget traces the retrieval of
  268.      each document by printing dots on the screen, each dot
  269.      representing a fixed amount of retrieved data.  Any number of dots
  270.      may be separated in a "cluster", to make counting easier.  This
  271.      option allows you to choose one of the pre-defined styles,
  272.      determining the number of bytes represented by a dot, the number
  273.      of dots in a cluster, and the number of dots on the line.
  274.      With the `default' style each dot represents 1K, there are ten dots
  275.      in a cluster and 50 dots in a line.  The `binary' style has a more
  276.      "computer"-like orientation--8K dots, 16-dots clusters and 64 dots
  277.      per line (which makes for 512K lines).  The `mega' style is
  278.      suitable for downloading very large files--each dot represents 64K
  279.      retrieved, there are eight dots in a cluster, and 48 dots on each
  280.      line (so each line contains 3M).  The `micro' style is exactly the
  281.      reverse; it is suitable for downloading small files, with 128-byte
  282.      dots, 8 dots per cluster, and 48 dots (6K) per line.
  283. `-e COMMAND'
  284. `--execute COMMAND'
  285.      Execute COMMAND as if it were a part of `.wgetrc' (*Note Startup
  286.      File::).  A command thus invoked will be executed *after* the
  287.      commands in `.wgetrc', thus taking precedence over them.
  288. `--exclude-domains DOMAIN-LIST'
  289.      Exclude the domains given in a comma-separated DOMAIN-LIST from
  290.      DNS-lookup (*Note Domain Acceptance::).
  291. `--force-html'
  292.      When input is read from a file, force it to be treated as an HTML
  293.      file.  This enables you to retrieve relative links from existing
  294.      HTML files on your local disk, by adding `<base href="URL">' to
  295.      HTML, or using the `--base' command-line option.
  296. `-g on/off'
  297. `--glob=on/off'
  298.      Turn FTP globbing on or off.  Globbing means you may use the
  299.      shell-like special characters ("wildcards"), like `*', `?', `['
  300.      and `]' to retrieve more than one file from the same directory at
  301.      once, like:
  302.           wget ftp://gnjilux.cc.fer.hr/*.msg
  303.      By default, globbing will be turned on if the URL contains a
  304.      globbing character.  This option may be used to turn globbing on
  305.      or off permanently.
  306.      You may have to quote the URL to protect it from being expanded by
  307.      your shell.  Globbing makes Wget look for a directory listing,
  308.      which is system-specific.  This is why it currently works only
  309.      with Unix FTP servers (and the ones emulating Unix `ls' output).
  310. `--ignore-length'
  311.      Unfortunately, some HTTP servers (CGI programs, to be more
  312.      precise) send out bogus `Content-Length' headers, which makes Wget
  313.      go wild, as it thinks not all the document was retrieved.  You can
  314.      spot this syndrome if Wget retries getting the same document again
  315.      and again, each time claiming that the (otherwise normal)
  316.      connection has closed on the very same byte.
  317.      With this option, Wget will ignore the `Content-Length' header--as
  318.      if it never existed.
  319. `--retr-symlinks'
  320.      Retrieve symbolic links on FTP sites as if they were plain files,
  321.      i.e. don't just create links locally.
  322. `--span-hosts'
  323.      Enable spanning across hosts when doing recursive retrieving
  324.      (*Note All Hosts::).
  325. `--header=ADDITIONAL-HEADER'
  326.      Define an ADDITIONAL-HEADER to be passed to the HTTP servers.
  327.      Headers must contain a `:' preceded by one or more non-blank
  328.      characters, and must not contain newlines.
  329.      You may define more than one additional header by specifying
  330.      `--header' more than once.
  331.           wget --header='Accept-Charset: iso-8859-2' \
  332.                --header='Accept-Language: hr'        \
  333.                  http://fly.cc.fer.hr/
  334.      Specification of an empty string as the header value will clear all
  335.      previous user-defined headers.
  336. `--http-user=USER'
  337. `--http-passwd=PASSWORD'
  338.      Specify the username USER and password PASSWORD on an HTTP server.
  339.      Wget will encode them using the `basic' (insecure) WWW
  340.      authentication scheme.  You can also encode the username and
  341.      password to the URL (*Note URL Format::).
  342.      For more data about security issues with Wget, *Note Security
  343.      Considerations::.
  344. `-I LIST'
  345. `--include-directories=LIST'
  346.      Specify a comma-separated list of directories you wish to follow
  347.      when downloading (*Note Directory-Based Limits:: for more details)
  348. `--convert-links'
  349.      Convert the non-relative links to relative ones locally.  Only the
  350.      references to the documents actually downloaded will be converted;
  351.      the rest will be left unchanged.
  352. `--relative'
  353.      Follow relative links only.  Useful for retrieving a specific home
  354.      page without any distractions, not even those from the same hosts
  355.      (*Note Relative Links::).
  356. `--mirror'
  357.      Turn on options suitable for mirroring.  This option turns on
  358.      recursion and time-stamping, sets infinite recursion depth and
  359.      keeps FTP directory listings.  It is currently equivalent to `-r
  360.      -N -l0 -nr'.
  361. `--timestamping'
  362.      Turn on time-stamping (*Note Time-Stamping:: for details).
  363. `-nd'
  364.      Do not create a hierarchy of directories when retrieving
  365.      recursively. With this option turned on, all files will get saved
  366.      to the current directory, without clobbering (if a name shows up
  367.      more than once, the filenames will get extensions `.n').
  368. `-nH'
  369.      Disable generation of host-prefixed directories.  By default,
  370.      invoking Wget with `-r http://fly.cc.fer.hr/' will create a
  371.      structure of directories beginning with `fly.cc.fer.hr/'.  This
  372.      option disables such behavior.
  373. `-nh'
  374.      Disable the time-consuming DNS lookup of almost all hosts (*Note
  375.      Host Checking::).
  376. `-np'
  377. `--no-parent'
  378.      Do not ever ascend to the parent directory when retrieving
  379.      recursively.  This is a useful option, since it guarantees that
  380.      only the files *below* a certain hierarchy will be downloaded.
  381.      *Note Directory-Based Limits:: for more details.
  382. `-nr'
  383.      Do not remove the `.listing' files generated by FTP.  This is
  384.      useful when running a mirror to see the remote file list.  It can
  385.      also be used for debugging purposes.
  386. `-nv'
  387.      Non-verbose output--turn off verbose without being completely quiet
  388.      (use `-q' for that), which means that error messages and basic
  389.      information still get printed.
  390. `-O FILE'
  391. `--output-document=FILE'
  392.      The documents will not be written to the appropriate files, but
  393.      all will be appended to a unique file specified by this option.
  394.      The number of tries will be set to 1 automatically.  If the FILE
  395.      is `-', the documents will be written to standard output, and
  396.      `--quiet' will be turned on.  This option is useful for making
  397.      Wget a part of pipelines (*Note Advanced Usage::).
  398.      Be careful, however, since setting `--quiet' turns off all the
  399.      useful diagnostics Wget can otherwise give.  This option is
  400.      usually a bad choice, as it disables a great number of Wget
  401.      features, e.g. recursive retrieval.
  402. `--passive-ftp'
  403.      Use the "passive" FTP retrieval scheme, in which the client
  404.      initiates the data connection.  This is sometimes required for FTP
  405.      to work behind firewalls.
  406. `-P PREFIX'
  407. `--directory-prefix=PREFIX'
  408.      Set directory prefix to PREFIX.  The "directory prefix" is the
  409.      directory where all other files and subdirectories will be saved
  410.      to, i.e. the top of the retrieval tree.  The default is `.' (the
  411.      current directory).
  412. `-Q QUOTA'
  413. `--quota=QUOTA'
  414.      Specify download quota for automatic retrievals.  The value can be
  415.      specified in bytes (default), kilobytes (with `k' suffix), or
  416.      megabytes (with `m' suffix).
  417.      Note that quota will never affect downloading a single file.  So
  418.      if you specify `wget -Q10k ftp://wuarchive.wustl.edu/ls-lR.gz',
  419.      all of the `ls-lR.gz' will be downloaded.  The same goes even when
  420.      several URLs are specified on the command-line.  However, quota is
  421.      respected when retrieving either recursively, or from an input
  422.      file.  Thus you may safely type `wget -Q2m -i sites'--download
  423.      will be aborted when the quota is exceeded.
  424.      Setting quota to 0 or to `inf' unlimits the download quota.
  425. `--server-response'
  426.      Print the headers sent by HTTP servers and responses sent by FTP
  427.      servers.
  428. `--save-headers'
  429.      Save the headers sent by the HTTP server to the file, preceding the
  430.      actual contents, with an empty line as the separator.
  431. `--spider'
  432.      When invoked with this option, Wget will behave as a Web "spider",
  433.      which means that it will not download the pages, just check that
  434.      they are there.  You can use it to check your bookmarks, e.g. with:
  435.           wget --spider --force-html -i bookmarks.html
  436.      This feature needs much more work for Wget to get close to the
  437.      functionality of real WWW spiders.
  438. `-T seconds'
  439. `--timeout=SECONDS'
  440.      Set the read timeout to SECONDS seconds.  Whenever a network read
  441.      is issued, the file descriptor is checked for a timeout, which
  442.      could otherwise leave a pending connection (uninterrupted read).
  443.      The default timeout is 900 seconds (fifteen minutes).  Setting
  444.      timeout to 0 will disable checking for timeouts.
  445.      Please do not lower the default timeout value with this option
  446.      unless you know what you are doing.
  447. `-w SECONDS'
  448. `--wait=SECONDS'
  449.      Wait the specified number of seconds between the retrievals.  Use
  450.      of this option is recommended, as it lightens the server load by
  451.      making the requests less frequent.
  452. `-X LIST'
  453. `--exclude-directories=LIST'
  454.      Specify a comma-separated list of directories you wish to exclude
  455.      from download (*Note Directory-Based Limits:: for more details).
  456.      The opposite of `-nd'--create a hierarchy of directories, even if
  457.      one would not have been created otherwise.  E.g. `wget -x
  458.      http://fly.cc.fer.hr/robots.txt' will save the downloaded file to
  459.      `fly.cc.fer.hr/robots.txt'.
  460. `-Y on/off'
  461. `--proxy=on/off'
  462.      Turn PROXY support on or off. The proxy is on by default if the
  463.      appropriate environmental variable is defined.
  464. File: wget.info,  Node: Recursive Retrieval,  Next: Following Links,  Prev: Invoking,  Up: Top
  465. Recursive Retrieval
  466. *******************
  467.    GNU Wget is capable of traversing parts of the Web (or a single HTTP
  468. or FTP server), depth-first following links and directory structure.
  469. This is called "recursive" retrieving, or "recursion".
  470.    With HTTP URLs, Wget retrieves and parses the HTML from the given
  471. URL, documents, retrieving the files the HTML document was referring
  472. to, through markups like `href', or `src'.  If the freshly downloaded
  473. file is also of type `text/html', it will be parsed and followed
  474. further.
  475.    The maximum "depth" to which the retrieval may descend is specified
  476. with the `-l' option (the default maximum depth is five layers).  *Note
  477. Basic Options::.
  478.    When retrieving an FTP URL recursively, Wget will retrieve all the
  479. data from the given directory tree (including the subdirectories up to
  480. the specified depth) on the remote server, creating its mirror image
  481. locally.  FTP retrieval is also limited by the `dept' parameter.
  482.    By default, Wget will create a local directory tree, corresponding to
  483. the one found on the remote server.
  484.    Recursive retrieving can find a number of applications, the most
  485. important of which is mirroring.  It is also useful for WWW
  486. presentations, and any other opportunities where slow network
  487. connections should be bypassed by storing the files locally.
  488.    You should be warned that invoking recursion may cause grave
  489. overloading on your system, because of the fast exchange of data
  490. through the network; all of this may hamper other users' work.  The
  491. same stands for the foreign server you are mirroring--the more requests
  492. it gets in a rows, the greater is its load.
  493.    Careless retrieving can also fill your file system unctrollably,
  494. which can grind the machine to a halt.
  495.    The load can be minimized by lowering the maximum recursion level
  496. (`-l') and/or by lowering the number of retries (`-t').  You may also
  497. consider using the `-w' option to slow down your requests to the remote
  498. servers, as well as the numerous options to narrow the number of
  499. followed links (*Note Following Links::).
  500.    Recursive retrieval is a good thing when used properly.  Please take
  501. all precautions not to wreak havoc through carelessness.
  502. File: wget.info,  Node: Following Links,  Next: Time-Stamping,  Prev: Recursive Retrieval,  Up: Top
  503. Following Links
  504. ***************
  505.    When retrieving recursively, one does not wish to retrieve the loads
  506. of unnecessary data.  Most of the time the users bear in mind exactly
  507. what they want to download, and want Wget to follow only specific links.
  508.    For example, if you wish to download the music archive from
  509. `fly.cc.fer.hr', you will not want to download all the home pages that
  510. happen to be referenced by an obscure part of the archive.
  511.    Wget possesses several mechanisms that allows you to fine-tune which
  512. links it will follow.
  513. * Menu:
  514. * Relative Links::         Follow relative links only.
  515. * Host Checking::          Follow links on the same host.
  516. * Domain Acceptance::      Check on a list of domains.
  517. * All Hosts::              No host restrictions.
  518. * Types of Files::         Getting only certain files.
  519. * Directory-Based Limits:: Getting only certain directories.
  520. * FTP Links::              Following FTP links.
  521. File: wget.info,  Node: Relative Links,  Next: Host Checking,  Prev: Following Links,  Up: Following Links
  522. Relative Links
  523. ==============
  524.    When only relative links are followed (option `-L'), recursive
  525. retrieving will never span hosts.  No time-expensive DNS-lookups will
  526. be performed, and the process will be very fast, with the minimum
  527. strain of the network.  This will suit your needs often, especially when
  528. mirroring the output of various `x2html' converters, since they
  529. generally output relative links.
  530. File: wget.info,  Node: Host Checking,  Next: Domain Acceptance,  Prev: Relative Links,  Up: Following Links
  531. Host Checking
  532. =============
  533.    The drawback of following the relative links solely is that humans
  534. often tend to mix them with absolute links to the very same host, and
  535. the very same page.  In this mode (which is the default mode for
  536. following links) all URLs the that refer to the same host will be
  537. retrieved.
  538.    The problem with this option are the aliases of the hosts and
  539. domains.  Thus there is no way for Wget to know that `regoc.srce.hr' and
  540. `www.srce.hr' are the same host, or that `fly.cc.fer.hr' is the same as
  541. `fly.cc.etf.hr'.  Whenever an absolute link is encountered, the host is
  542. DNS-looked-up with `gethostbyname' to check whether we are maybe
  543. dealing with the same hosts.  Although the results of `gethostbyname'
  544. are cached, it is still a great slowdown, e.g. when dealing with large
  545. indices of home pages on different hosts (because each of the hosts
  546. must be and DNS-resolved to see whether it just *might* an alias of the
  547. starting host).
  548.    To avoid the overhead you may use `-nh', which will turn off
  549. DNS-resolving and make Wget compare hosts literally.  This will make
  550. things run much faster, but also much less reliable (e.g. `www.srce.hr'
  551. and `regoc.srce.hr' will be flagged as different hosts).
  552.    Note that HTTP/1.1 allows one IP address to support several virtual
  553. servers, each of them with its own root; this feature is also used by
  554. many HTTP/1.0 servers.  Such "servers" are then distinguished by their
  555. hostnames (all of which point to the same IP address); for this to
  556. work, a client must send a `Host' header, which is what Wget does.
  557. However, in that case Wget *must not* try to divine a host's "real"
  558. address, nor try to use the same hostname for each access, i.e. `-nh'
  559. must be turned on.
  560.    In other words, the `-nh' option must be used to enabling the
  561. retrieval from virtual servers distinguished by their hostnames.  As the
  562. number of such server setups grow, the behavior of `-nh' may become the
  563. default in the future.
  564. File: wget.info,  Node: Domain Acceptance,  Next: All Hosts,  Prev: Host Checking,  Up: Following Links
  565. Domain Acceptance
  566. =================
  567.    With the `-D' option you may specify the domains that will be
  568. followed.  The hosts the domain of which is not in this list will not be
  569. DNS-resolved.  Thus you can specify `-Dmit.edu' just to make sure that
  570. *nothing outside of MIT gets looked up*.  This is very important and
  571. useful.  It also means that `-D' does *not* imply `-H' (span all
  572. hosts), which must be specified explicitly.  Feel free to use this
  573. options since it will speed things up, with almost all the reliability
  574. of checking for all hosts.  Thus you could invoke
  575.      wget -r -D.hr http://fly.cc.fer.hr/
  576.    to make sure that only the hosts in `.hr' domain get DNS-looked-up
  577. for being equal to `fly.cc.fer.hr'.  So `fly.cc.etf.hr' will be checked
  578. (only once!) and found equal, but `www.gnu.ai.mit.edu' will not even be
  579. checked.
  580.    Of course, domain acceptance can be used to limit the retrieval to
  581. particular domains with spanning of hosts in them, but then you must
  582. specify `-H' explicitly.  E.g.:
  583.      wget -r -H -Dmit.edu,stanford.edu http://www.mit.edu/
  584.    will start with `http://www.mit.edu/', following links across MIT
  585. and Stanford.
  586.    If there are domains you want to exclude specifically, you can do it
  587. with `--exclude-domains', which accepts the same type of arguments of
  588. `-D', but will *exclude* all the listed domains.  For example, if you
  589. want to download all the hosts from `foo.edu' domain, with the
  590. exception of `sunsite.foo.edu', you can do it like this:
  591.      wget -rH -Dfoo.edu --exclude-domains sunsite.foo.edu http://www.foo.edu/
  592. File: wget.info,  Node: All Hosts,  Next: Types of Files,  Prev: Domain Acceptance,  Up: Following Links
  593. All Hosts
  594. =========
  595.    When `-H' is specified without `-D', all hosts are freely spanned.
  596. There are no restrictions whatsoever as to what part of the net Wget
  597. will go to fetch documents, other than maximum retrieval depth.  If a
  598. page references `www.yahoo.com', so be it.  Such an option is rarely
  599. useful for itself.
  600. File: wget.info,  Node: Types of Files,  Next: Directory-Based Limits,  Prev: All Hosts,  Up: Following Links
  601. Types of Files
  602. ==============
  603.    When downloading material from the web, you will often want to
  604. restrict the retrieval to only certain file types.  For example, if you
  605. are interested in downloading GIFS, you will not be overjoyed to get
  606. loads of Postscript documents, and vice versa.
  607.    Wget offers two options to deal with this problem.  Each option
  608. description lists a short name, a long name, and the equivalent command
  609. in `.wgetrc'.
  610. `-A ACCLIST'
  611. `--accept ACCLIST'
  612. `accept = ACCLIST'
  613.      The argument to `--accept' option is a list of file suffixes or
  614.      patterns that Wget will download during recursive retrieval.  A
  615.      suffix is the ending part of a file, and consists of "normal"
  616.      letters, e.g. `gif' or `.jpg'.  A matching pattern contains
  617.      shell-like wildcards, e.g. `books*' or `zelazny*196[0-9]*'.
  618.      So, specifying `wget -A gif,jpg' will make Wget download only the
  619.      files ending with `gif' or `jpg', i.e. GIFs and JPEGs.  On the
  620.      other hand, `wget -A "zelazny*196[0-9]*"' will download only files
  621.      beginning with `zelazny' and containing numbers from 1960 to 1969
  622.      anywhere within.  Look up the manual of your shell for a
  623.      description of how pattern matching works.
  624.      Of course, any number of suffixes and patterns can be combined
  625.      into a comma-separated list, and given as an argument to `-A'.
  626. `-R REJLIST'
  627. `--reject REJLIST'
  628. `reject = REJLIST'
  629.      The `--reject' option works the same way as `--accept', only its
  630.      logic is the reverse; Wget will download all files *except* the
  631.      ones matching the suffixes (or patterns) in the list.
  632.      So, if you want to download a whole page except for the cumbersome
  633.      MPEGs and .AU files, you can use `wget -R mpg,mpeg,au'.
  634.      Analogously, to download all files except the ones beginning with
  635.      `bjork', use `wget -R "bjork*"'.  The quotes are to prevent
  636.      expansion by the shell.
  637.    The `-A' and `-R' options may be combined to achieve even better
  638. fine-tuning of which files to retrieve.  E.g. `wget -A "*zelazny*" -R
  639. .ps' will download all the files having `zelazny' as a part of their
  640. name, but *not* the postscript files.
  641.    Note that these two options do not affect the downloading of HTML
  642. files; Wget must load all the HTMLs to know where to go at
  643. all--recursive retrieval would make no sense otherwise.
  644. File: wget.info,  Node: Directory-Based Limits,  Next: FTP Links,  Prev: Types of Files,  Up: Following Links
  645. Directory-Based Limits
  646. ======================
  647.    Regardless of other link-following facilities, it is often useful to
  648. place the restriction of what files to retrieve based on the directories
  649. those files are placed in.  There can be many reasons for this--the
  650. home pages may be organized in a reasonable directory structure; or some
  651. directories may contain useless information, e.g. `/cgi-bin' or `/dev'
  652. directories.
  653.    Wget offers three different options to deal with this requirement.
  654. Each option description lists a short name, a long name, and the
  655. equivalent command in `.wgetrc'.
  656. `-I LIST'
  657. `--include LIST'
  658. `include_directories = LIST'
  659.      `-I' option accepts a comma-separated list of directories included
  660.      in the retrieval.  Any other directories will simply be ignored.
  661.      The directories are absolute paths.
  662.      So, if you wish to download from `http://host/people/bozo/'
  663.      following only links to bozo's colleagues in the `/people'
  664.      directory and the bogus scripts in `/cgi-bin', you can specify:
  665.           wget -I /people,/cgi-bin http://host/people/bozo/
  666. `-X LIST'
  667. `--exclude LIST'
  668. `exclude_directories = LIST'
  669.      `-X' option is exactly the reverse of `-I'--this is a list of
  670.      directories *excluded* from the download.  E.g. if you do not want
  671.      Wget to download things from `/cgi-bin' directory, specify `-X
  672.      /cgi-bin' on the command line.
  673.      The same as with `-A'/`-R', these two options can be combined to
  674.      get a better fine-tuning of downloading subdirectories.  E.g. if
  675.      you want to load all the files from `/pub' hierarchy except for
  676.      `/pub/worthless', specify `-I/pub -X/pub/worthless'.
  677. `-np'
  678. `--no-parent'
  679. `no_parent = on'
  680.      The simplest, and often very useful way of limiting directories is
  681.      disallowing retrieval of the links that refer to the hierarchy
  682.      "upper" than the beginning directory, i.e. disallowing ascent to
  683.      the parent directory/directories.
  684.      The `--no-parent' option (short `-np') is useful in this case.
  685.      Using it guarantees that you will never leave the existing
  686.      hierarchy.  Supposing you issue Wget with:
  687.           wget -r --no-parent http://somehost/~luzer/my-archive/
  688.      You may rest assured that none of the references to
  689.      `/~his-girls-homepage/' or `/~luzer/all-my-mpegs/' will be
  690.      followed.  Only the archive you are interested in will be
  691.      downloaded.  Essentially, `--no-parent' is similar to
  692.      `-I/~luzer/my-archive', only it handles redirections in a more
  693.      intelligent fashion.
  694. File: wget.info,  Node: FTP Links,  Prev: Directory-Based Limits,  Up: Following Links
  695. Following FTP Links
  696. ===================
  697.    The rules for FTP are somewhat specific, as it is necessary for them
  698. to be.  FTP links in HTML documents are often included for purposes of
  699. reference, and it is often inconvenient to download them by default.
  700.    To have FTP links followed from HTML documents, you need to specify
  701. the `-f' (`--follow-ftp') option.  Having done that, FTP links will
  702. span hosts regardless of `-H' setting.  This is logical, as FTP links
  703. rarely point to the same host where the HTTP server resides.  For
  704. similar reasons, the `-L' options has no effect on such downloads.  On
  705. the other hand, domain acceptance (`-D') and suffix rules (`-A' and
  706. `-R') apply normally.
  707.    Also note that followed links to FTP directories will not be
  708. retrieved recursively further.
  709. File: wget.info,  Node: Time-Stamping,  Next: Startup File,  Prev: Following Links,  Up: Top
  710. Time-Stamping
  711. *************
  712.    One of the most important aspects of mirroring information from the
  713. Internet is updating your archives.
  714.    Downloading the whole archive again and again, just to replace a few
  715. changed files is expensive, both in terms of wasted bandwidth and money,
  716. and the time to do the update.  This is why all the mirroring tools
  717. offer the option of incremental updating.
  718.    Such an updating mechanism means that the remote server is scanned in
  719. search of "new" files.  Only those new files will be downloaded in the
  720. place of the old ones.
  721.    A file is considered new if one of these two conditions are met:
  722.   1. A file of that name does not already exist locally.
  723.   2. A file of that name does exist, but the remote file was modified
  724.      more recently than the local file.
  725.    To implement this, the program needs to be aware of the time of last
  726. modification of both remote and local files.  Such information are
  727. called the "time-stamps".
  728.    The time-stamping in GNU Wget is turned on using `--timestamping'
  729. (`-N') option, or through `timestamping = on' directive in `.wgetrc'.
  730. With this option, for each file it intends to download, Wget will check
  731. whether a local file of the same name exists.  If it does, and the
  732. remote file is older, Wget will not download it.
  733.    If the local file does not exist, or the sizes of the files do not
  734. match, Wget will download the remote file no matter what the time-stamps
  735. * Menu:
  736. * Time-Stamping Usage::
  737. * HTTP Time-Stamping Internals::
  738. * FTP Time-Stamping Internals::
  739. File: wget.info,  Node: Time-Stamping Usage,  Next: HTTP Time-Stamping Internals,  Prev: Time-Stamping,  Up: Time-Stamping
  740. Time-Stamping Usage
  741. ===================
  742.    The usage of time-stamping is simple.  Say you would like to
  743. download a file so that it keeps its date of modification.
  744.      wget -S http://www.gnu.ai.mit.edu/
  745.    A simple `ls -l' shows that the time stamp on the local file equals
  746. the state of the `Last-Modified' header, as returned by the server.  As
  747. you can see, the time-stamping info is preserved locally, even without
  748. `-N'.
  749.    Several days later, you would like Wget to check if the remote file
  750. has changed, and download it if it has.
  751.      wget -N http://www.gnu.ai.mit.edu/
  752.    Wget will ask the server for the last-modified date.  If the local
  753. file is newer, the remote file will not be re-fetched.  However, if the
  754. remote file is more recent, Wget will proceed fetching it normally.
  755.    The same goes for FTP.  For example:
  756.      wget ftp://ftp.ifi.uio.no/pub/emacs/gnus/*
  757.    `ls' will show that the timestamps are set according to the state on
  758. the remote server.  Reissuing the command with `-N' will make Wget
  759. re-fetch *only* the files that have been modified.
  760.    In both HTTP and FTP retrieval Wget will time-stamp the local file
  761. correctly (with or without `-N') if it gets the stamps, i.e. gets the
  762. directory listing for FTP or the `Last-Modified' header for HTTP.
  763.    If you wished to mirror the GNU archive every week, you would use the
  764. following command every week:
  765.      wget --timestamping -r ftp://prep.ai.mit.edu/pub/gnu/
  766. File: wget.info,  Node: HTTP Time-Stamping Internals,  Next: FTP Time-Stamping Internals,  Prev: Time-Stamping Usage,  Up: Time-Stamping
  767. HTTP Time-Stamping Internals
  768. ============================
  769.    Time-stamping in HTTP is implemented by checking of the
  770. `Last-Modified' header.  If you wish to retrieve the file `foo.html'
  771. through HTTP, Wget will check whether `foo.html' exists locally.  If it
  772. doesn't, `foo.html' will be retrieved unconditionally.
  773.    If the file does exist locally, Wget will first check its local
  774. time-stamp (similar to the way `ls -l' checks it), and then send a
  775. `HEAD' request to the remote server, demanding the information on the
  776. remote file.
  777.    The `Last-Modified' header is examined to find which file was
  778. modified more recently (which makes it "newer").  If the remote file is
  779. newer, it will be downloaded; if it is older, Wget will give up.(1)
  780.    Arguably, HTTP time-stamping should be implemented using the
  781. `If-Modified-Since' request.
  782.    ---------- Footnotes ----------
  783.    (1)  As an additional check, Wget will look at the `Content-Length'
  784. header, and compare the sizes; if they are not the same, the remote
  785. file will be downloaded no matter what the time-stamp says.
  786. File: wget.info,  Node: FTP Time-Stamping Internals,  Prev: HTTP Time-Stamping Internals,  Up: Time-Stamping
  787. FTP Time-Stamping Internals
  788. ===========================
  789.    In theory, FTP time-stamping works much the same as HTTP, only FTP
  790. has no headers--time-stamps must be received from the directory
  791. listings.
  792.    For each directory files must be retrieved from, Wget will use the
  793. `LIST' command to get the listing.  It will try to analyze the listing,
  794. assuming that it is a Unix `ls -l' listing, and extract the
  795. time-stamps.  The rest is exactly the same as for HTTP.
  796.    Assumption that every directory listing is a Unix-style listing may
  797. sound extremely constraining, but in practice it is not, as many
  798. non-Unix FTP servers use the Unixoid listing format because most (all?)
  799. of the clients understand it.  Bear in mind that RFC959 defines no
  800. standard way to get a file list, let alone the time-stamps.  We can
  801. only hope that a future standard will define this.
  802.    Another non-standard solution includes the use of `MDTM' command
  803. that is supported by some FTP servers (including the popular
  804. `wu-ftpd'), which returns the exact time of the specified file.  Wget
  805. may support this command in the future.
  806. File: wget.info,  Node: Startup File,  Next: Examples,  Prev: Time-Stamping,  Up: Top
  807. Startup File
  808. ************
  809.    Once you know how to change default settings of Wget through command
  810. line arguments, you may wish to make some of those settings permanent.
  811. You can do that in a convenient way by creating the Wget startup
  812. file--`.wgetrc'.
  813.    Besides `.wgetrc' is the "main" initialization file, it is
  814. convenient to have a special facility for storing passwords.  Thus Wget
  815. reads and interprets the contents of `$HOME/.netrc', if it finds it.
  816. You can find `.netrc' format in your system manuals.
  817.    Wget reads `.wgetrc' upon startup, recognizing a limited set of
  818. commands.
  819. * Menu:
  820. * Wgetrc Location::   Location of various wgetrc files.
  821. * Wgetrc Syntax::     Syntax of wgetrc.
  822. * Wgetrc Commands::   List of available commands.
  823. * Sample Wgetrc::     A wgetrc example.
  824. File: wget.info,  Node: Wgetrc Location,  Next: Wgetrc Syntax,  Prev: Startup File,  Up: Startup File
  825. Wgetrc Location
  826. ===============
  827.    When initializing, Wget will look for a "global" startup file,
  828. `/usr/local/etc/wgetrc' by default (or some prefix other than
  829. `/usr/local', if Wget was not installed there) and read commands from
  830. there, if it exists.
  831.    Then it will look for the user's file.  If the environmental variable
  832. `WGETRC' is set, Wget will try to load that file.  Failing that, no
  833. further attempts will be made.
  834.    If `WGETRC' is not set, Wget will try to load `$HOME/.wgetrc'.
  835.    The fact that user's settings are loaded after the system-wide ones
  836. means that in case of collision user's wgetrc *overrides* the
  837. system-wide wgetrc (in `/usr/local/etc/wgetrc' by default).  Fascist
  838. admins, away!
  839. File: wget.info,  Node: Wgetrc Syntax,  Next: Wgetrc Commands,  Prev: Wgetrc Location,  Up: Startup File
  840. Wgetrc Syntax
  841. =============
  842.    The syntax of a wgetrc command is simple:
  843.      variable = value
  844.    The "variable" will also be called "command".  Valid "values" are
  845. different for different commands.
  846.    The commands are case-insensitive and underscore-insensitive.  Thus
  847. `DIr__PrefiX' is the same as `dirprefix'.  Empty lines, lines beginning
  848. with `#' and lines containing white-space only are discarded.
  849.    Commands that expect a comma-separated list will clear the list on an
  850. empty command.  So, if you wish to reset the rejection list specified in
  851. global `wgetrc', you can do it with:
  852.      reject =
  853.